*****************************************************************************************************************
* Replication for Elements title 'IMF lending: partisanship, punishment, and protest'
*****************************************************************************************************************

/* 
  Table of contents:
  * Global statistics on IMF SAPs
  * Afrobarometer
  * Asian Barometer
  * Latinobarometer
  * World Values Survey
*/


* IMF statistics by region 
*******************************************************************************

  use "IMF_SAPs_data", clear 
  
  preserve
  
    drop if incid==1
	replace BA2TOT=. if IMFnn==0 | IMFnn==.
    collapse (sum)IMFnn (sum)BA2TOT, by(regid year)
	drop if regid==.
	reshape wide IMFnn BA2TOT, i(year) j(regid)
	
	** Figure 1 **
	twoway connected IMFnn* year, scheme(s1mono) xtitle(" ") ytitle(Countries under IMF programs) legend(lab(1 "Sub-Sahara Africa") lab(2 "East Asia and Pacific") lab(3 "Europe and Central Asia") lab(4 "Latin America and Caribbean") lab(5 "Middle East and North Africa") lab(6 "South Asia") rows(3)) 
	
	** Figure 2 **
	twoway connected BA2TOT* year, scheme(s1mono) xtitle(" ") ytitle(Total number of conditions) legend(lab(1 "Sub-Sahara Africa") lab(2 "East Asia and Pacific") lab(3 "Europe and Central Asia") lab(4 "Latin America and Caribbean") lab(5 "Middle East and North Africa") lab(6 "South Asia") rows(3)) 
	
  restore

  
* Afrobarometer (W1)
*******************************************************************************
 
  use "Afrobarometer_replication", clear 
  
  g sap_bad=(sapmin==3|sapmin==4)
  lab var sap_bad "SAP worse for people"
  tab sapsat
  g sap_worse=(sapsat==1|sapsat==2)
  lab var sap_worse "SAP worse for me"
  
  g x_prot=(pardem>=2)
  replace x_prot=. if pardem>4
  g x_protall=(pardem>=2)
  replace x_protall=. if pardem>5
  
  g x_pwinner=(pidwin==3)
  lab var x_pwinner "Close to ruling party"
  replace x_pwinner=. if x_pwinner>=4
  g x_ploser=pidwin==1
  lab var x_ploser "Opposed to ruling party"
  replace x_ploser=. if x_ploser>=4
  
  g x_pf=(pfgpre==1|pfgpre==2)
  lab var x_pf "President performance: Dissatisfied"
  g x_pf_lvs=(pfesol==1|pfesol==2)
  lab var x_pf_lvs "Dissatisfied with how government manages living standards"
  g x_pf_jobs=(pfeemp==1|pfeemp==2)
  g x_sateco=(pfenow==4|pfenow==5)
  lab var x_sateco "Satisfied with economy now"
  g x_pf_past=(pfepas==1|pfepas==2)
  lab var x_pf_past "Economic conditions: Worse than one year ago"
  g x_pf_fut=(pfefut==1|pfefut==2)
  lab var x_pf_fut "Future economy: Expect to be worse"
  g x_assn=(pfrass==1|pfrass==2)
  lab var x_assn "Freedom of association: Worse now than 1 year"
  g x_supdem=(supdem==1)  
  g x_govrat=(supnow)
  replace x_gov=. if x_gov==99
  g x_favexp=(rejexp==4|rejexp==5)
  g x_satdem=(dmpsat==4|dmpsat==5)
  g x_smarket=(spamar==1|spamar==2)
  g x_scapital=(marear==1|marear==2)
  g x_spubsec=(sparet==1|sparet==2)
  g x_spri=(spaprv==1|spaprv==2)
  
  g x_male=gender==1
  replace age=. if age>100 | age==0
  g x_higheduc=educ==3
  g x_educ=(educ>=3)
  replace x_educ=. if educ>=5
  g emp=unemp==1
  g x_unemp=(occup==1)
  g x_urb=urbrur==1
  g x_radio=medrad==4|medrad==5
  g x_intpol=scint==1
  g x_knowfm=sckfin==2
  g psj=occup==10|occup==11|occup==17|occup==20|occup==48
  lab var psj "Public-sector worker"


  ** Preparations for regressions **
  encode iso3, g(ccode)
  svyset ccode [pweight=afcombwt] 
  
  g lnage=ln(age)
  global X  x_male lnage x_urb x_unemp x_higheduc x_radio x_intpol x_knowfm
  global P  x_satdem x_smarket x_scap x_spub x_spri 
  global E  x_pf_past x_pf_fut x_pf
  
  g PID=(1)*(pidwin==2)+(2)*(pidwin==1)+(3)*(pidwin==3)
  replace PID=. if pidwin>3
  lab var PID "3=win, 1=neutral, 2=lose"
    
  g PIDN=3-PID
  replace PIDN=. if PID==1
  lab var PIDN "Winner/Loser"
  corr PIDN x_pwinner
  
  g knwsap=sapknw==2

  ** Lack of variation (question not asked) **
  bys country: su sapmin sapsat pidwin povfoo
  foreach k in 1 3 6 {
    replace sapmin=. if country==`k'
	replace sapsat=. if country==`k'
	replace sap_bad=. if country==`k'
	replace sap_worse=. if country==`k'
  }
  replace sapmin=. if iso3=="UGA"
  replace sap_bad=. if iso3=="UGA"
  replace povfoo=. if iso3=="UGA"
  replace pardem=. if iso3=="UGA"
  replace x_prot=. if iso3=="UGA"
  replace x_protall=. if iso3=="UGA"
  
  g NoData0=(country==1|country==3|country==6)
  g NoData1=(NoData0==1|country==10)
  
  
* Evaluations of the SAP 
************************

* Figures 

  g SAPSAT=.
  replace SAPSAT=4 if sapsat==1
  replace SAPSAT=3 if sapsat==2
  replace SAPSAT=5 if sapsat==3
  replace SAPSAT=2 if sapsat==4
  replace SAPSAT=1 if sapsat==5
  
  ** Figure 3 **
  graph bar if sapknw==2, over(SAPSAT, relabel(1 "Very satisfied/ A lot better" 2 "Satisfied/ Better" 3 "Neutral/ No effect" 4 "Unsatisfied/ Worse" 5 "Very unsatisfied/ A lot worse") label(angle(90))) scheme(s1mono) note(" ")
  
  g PIDWIN=pidwin
  replace PIDWIN=4 if pidwin==1 
  replace PIDWIN=. if PIDWIN==1 | PIDWIN>4
  
  ** Figure 14 **
  graph bar if sapknw==2, over(PIDWIN, relabel(1 "Non-partisan" 2 "Government supporter" 3 "Opposition supporter")) scheme(s1mono) ytitle(percent)
  
  ** Figure A1 **
  graph bar if SAPSAT<=5 & sapknw==2, by(country, rows(3) note(" ")) over(SAPSAT, nolabel) scheme(s1mono) 

  ** Figure 17 **
  graph bar sap_worse if sapknw==2 & NoData0==0, over(PIDN, relabel(1 "Government supporter" 2 "Opposition supporter")) scheme(s1mono) legend(off) ytitle(SAP made my life worse)
  
  ** Figure 18 **
  graph bar sap_worse if sapknw==2 & NoData0==0, over(PIDN, relabel(1 "Government supporter" 2 "Opposition supporter")) scheme(s1mono) legend(off) ytitle(SAP made my life worse) by(IMFnn, note(" "))
    ttest sap_worse if sapknw==2 & NoData0==0, by(PIDN) une
	** diff=-.184 p<0.0001
	ttest sap_worse if L1IMFnn>0 & sapknw==2 & NoData0==0, by(PIDN) une
	** diff=-.222 p<0.0001
	ttest sap_worse if L1IMFnn==0 & sapknw==2 & NoData0==0, by(PIDN) une
	** diff=-.024 p<0.538

  su L1BA2TOT if L1IMFnn!=0, d	
  g BAsplit=L1BA2TOT>27
  
  ** Figure 19 **
  graph bar sap_worse if sapknw==2 & NoData0==0 & IMFnn>0, by(BAsplit, note(" ")) over(PIDN, relabel(2 "Opposition supporter" 1 "Government supporter")) scheme(s1mono) legend(off) ytitle(SAP made my life worse)
  
  
* Tables

  ** Baseline results with partisanship
  qui reg sap_w i.PIDN i.country [aw=afcombwt] if sapknw==2, cl(country)
  est store a11
  qui reg sap_w i.PIDN $X $P i.country [aw=afcombwt] if sapknw==2, cl(country)
  est store a12
  qui reg sap_w i.PIDN $X $P $E i.country [aw=afcombwt] if sapknw==2, cl(country)
  est store a13
  
  ** Table 1 **   
  estout a1*, note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons *countr* 0.*) stats(N r2_a, fmt(0 3)) 

  est restore a11
  margins PIDN, dydx() vce(uncond)  
  est restore a13 
  margins PIDN, dydx() vce(uncond)

  
  ** Differential exposure to IMF SAPs
  qui reg sap_w i.PIDN i.country if knwsap==1 & IMFnn==1 [aw=afcombwt], cl(country)
  est store a21
  qui reg sap_w i.PIDN $X $P i.country if knwsap==1 & IMFnn==1 [aw=afcombwt], cl(country)
  est store a22
  qui reg sap_w i.PIDN $X $P $E i.country if knwsap==1 & IMFnn==1 [aw=afcombwt], cl(country)
  est store a23
  qui reg sap_w i.PIDN i.country if knwsap==1 & IMFnn==0 [aw=afcombwt], cl(country)
  est store a24
  qui reg sap_w i.PIDN $X $P i.country if knwsap==1 & IMFnn==0 [aw=afcombwt], cl(country)
  est store a25
  qui reg sap_w i.PIDN $X $P $E i.country if knwsap==1 & IMFnn==0 [aw=afcombwt], cl(country)
  est store a26

  ** Table 2 **   
  estout a2*, note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons *0.* *countr*) stats(N r2_a, fmt(0 3))   
  
  est restore a23
  margins i.PIDN, dydx() vce(unconditional)
  est restore a26
  margins i.PIDN, dydx() vce(unconditional)


  ** Above-median conditionality 
  su BA2TOT if IMFnn==1, d
  g basplit=BA2TOT>=30
  
  qui reg sap_w i.PIDN i.country if basplit==1 & IMFnn==1 [aw=afcombwt], cl(country)
  est store a31
  qui reg sap_w i.PIDN $X $P i.country if basplit==1 & IMFnn==1 [aw=afcombwt], cl(country)
  est store a32
  qui reg sap_w i.PIDN $X $P $E i.country if basplit==1 & IMFnn==1 [aw=afcombwt], cl(country)
  est store a33
  qui reg sap_w i.PIDN i.country if basplit==0 & IMFnn==1 [aw=afcombwt], cl(country)
  est store a34
  qui reg sap_w i.PIDN $X $P i.country if basplit==0 & IMFnn==1 [aw=afcombwt], cl(country)
  est store a35
  qui reg sap_w i.PIDN $X $P $E i.country if basplit==0 & IMFnn==1 [aw=afcombwt], cl(country)
  est store a36
  
  ** Table 3 **   
  estout a3*, note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons *0.* *countr*) stats(N r2_a, fmt(0 3))   

  est restore a33
  margins i.PIDN, dydx() vce(unconditional)
  est restore a36
  margins i.PIDN, dydx() vce(unconditional)


* Further analyses

  ** Public sector
  qui reg sap_w i.PIDN i.country if IMFnn>0 & psj==1 & knwsap==1 [aw=afcombwt], cl(country)
  est store a41 
  qui reg sap_w i.PIDN $X $P i.country if IMFnn>0 & psj==1 & knwsap==1 [aw=afcombwt], cl(country)
  est store a42 
  qui reg sap_w i.PIDN $X $P $E i.country if IMFnn>0 & psj==1 & knwsap==1 [aw=afcombwt], cl(country)
  est store a43
  qui reg sap_w i.PIDN $X i.country if IMFnn>0 & psj==0 & knwsap==1 [aw=afcombwt], cl(country)
  est store a44 
  qui reg sap_w i.PIDN $X $P i.country if IMFnn>0 & psj==0 & knwsap==1 [aw=afcombwt], cl(country)
  est store a45 
  qui reg sap_w i.PIDN $X $P $E i.country if IMFnn>0 & psj==0 & knwsap==1 [aw=afcombwt], cl(country)
  est store a46
  
  ** Table A6 **
  estout a4*, note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons *0.* *countr*) stats(N r2_a, fmt(0 3))   

  est restore a43
  margins i.PIDN, dydx() vce(unconditional)
  est restore a46
  margins i.PIDN, dydx() vce(unconditional)  


  ** Deprivation index 
  foreach x in povfoo povwat povhth povinc{
    g x_`x'=`x'
    replace x_`x'=. if `x'>4
    }
  
  egen x_pov=rowtotal(x_pov*)
  replace x_pov=. if x_povfoo==.|x_povwat==.|x_povhth==.|x_povinc==.
  replace x_pov=x_pov-4
  
  qui reg x_pov i.PIDN##IMFnn i.country [aw=afcombwt], cl(country)
  est store a51
  qui reg x_pov i.PIDN##IMFnn $X $P i.country [aw=afcombwt] , cl(country)
  est store a52
  qui reg x_pov i.PIDN##IMFnn $X $P $E i.country [aw=afcombwt], cl(country)
  est store a53

  ** Table A7 **
  estout a5*, note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons *0.* *countr*) stats(N r2_a, fmt(0 3))   
  
  qui reg x_pov i.PIDN##c.BA2TOT i.country [aw=afcombwt] if IMFnn>0, cl(country)
  est store a61
  qui reg x_pov i.PIDN##c.BA2TOT $X $P i.country [aw=afcombwt] if IMFnn>0, cl(country)
  est store a62
  qui reg x_pov i.PIDN##c.BA2TOT $X $P $E i.country [aw=afcombwt] if IMFnn>0, cl(country)
  est store a63
  
  ** Table A8 **
  estout a6*, note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons *0.* *countr*) stats(N r2_a, fmt(0 3))   

  
  ** Selection model
  global F x_intpol x_knowfm
  global X  x_male lnage x_urb emp x_educ  x_supdem x_intpol x_knowfm 
  global XS x_male lnage x_urb emp x_educ x_supdem 
  global XL $XS x_satdem x_smarket x_scapital x_spubsec x_spri x_pf_past x_pf_fut x_pf
    
  mat S1=J(5,3,0)
  mat S2=S1
  cmp setup 
  set matsize 800
  qui xi:reg sap_w i.country
  
  qui cmp (knwsap=$F PIDN _Icountry*) (sap_w=PIDN _Icountry*), indicators(1 knwsap) ro cl(country) iterate(30)  
  est store a71
   mat S1[1,1]=e(N1)
   mat S1[4,1]=e(N2)
   qui test [knwsap] $F
   mat S1[3,1]=r(chi2)
   qui reg knwsap  PIDN $F _Icountry* 
   mat S1[2,1]=e(r2)
   qui reg sap_w PIDN _Icountry* if knwsap
   mat S1[5,1]=e(r2)
   
  qui cmp (knwsap=$F $XS PIDN _Icountry*) (sap_w=PIDN $XS _Icountry*), indicators(1 knwsap) ro cl(country) 
   est store a72
   mat S1[1,2]=e(N1)
   mat S1[4,2]=e(N2)
   qui test [knwsap] $F
   mat S1[3,2]=r(chi2)
   qui reg knwsap  PIDN $F $XS _Icountry* 
   mat S1[2,2]=e(r2)
   qui reg sap_w PIDN $XS _Icountry* if knwsap
   mat S1[5,2]=e(r2)
  
  qui cmp (knwsap=$F $XL PIDN _Icountry*) (sap_w=PIDN $XL _Icountry*), indicators(1 knwsap) ro cl(country) 
   est store a73
   mat S1[1,3]=e(N1)
   mat S1[4,3]=e(N2)
   qui test [knwsap] $F
   mat S1[3,3]=r(chi2)
   qui reg knwsap  PIDN $F $XL _Icountry* 
   mat S1[2,3]=e(r2)
   qui reg sap_w PIDN $XL _Icountry* if knwsap
   mat S1[5,3]=e(r2)
  
  ** Table A9 **   
  estout a7*, note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons  *countr*) stats(N r2_a, fmt(0 3))   
  mat li S1   
  
  
  g Xloser=BA2TOT*PIDN
  
  qui cmp (knwsap=$F BA2TOT PIDN _Icountry*) (sap_w=BA2TOT Xloser PIDN _Icountry*), indicators(1 knwsap) ro cl(country) 
  est store a81
   mat S2[1,1]=e(N1)
   mat S2[4,1]=e(N2)
   qui test [knwsap] $F
   mat S2[3,1]=r(chi2)
   qui reg knwsap $F BA2TOT PIDN _Icountry* 
   mat S2[2,1]=e(r2)
   qui reg sap_w BA2TOT Xloser PIDN _Icountry* if knwsap
   mat S2[5,1]=e(r2)
   
  qui cmp (knwsap=$F $XS BA2TOT PIDN _Icountry*) (sap_w=BA2TOT Xloser PIDN $XS _Icountry*), indicators(1 knwsap) ro cl(country) 
  est store a82
   mat S2[1,2]=e(N1)
   mat S2[4,2]=e(N2)
   qui test [knwsap] $F
   mat S2[3,2]=r(chi2)
   qui reg knwsap $F $XS BA2TOT PIDN _Icountry* 
   mat S2[2,2]=e(r2)
   qui reg sap_w BA2TOT Xloser PIDN $XS _Icountry* if knwsap
   mat S2[5,2]=e(r2)
   
  qui cmp (knwsap=$F $XL BA2TOT PIDN _Icountry*) (sap_w=BA2TOT Xloser PIDN $XL _Icountry*), indicators(1 knwsap) ro cl(country) 
  est store a83
   mat S2[1,3]=e(N1)
   mat S2[4,3]=e(N2)
   qui test [knwsap] $F
   mat S2[3,3]=r(chi2)
   qui reg knwsap $F $XL BA2TOT PIDN _Icountry* 
   mat S2[2,3]=e(r2)
   qui reg sap_w BA2TOT Xloser PIDN $XL _Icountry* if knwsap
   mat S2[5,3]=e(r2)
   
  ** Table A10 **   
  estout a8*, note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons  *countr*) stats(N r2_a, fmt(0 3))   
  mat li S2   
  
  global X  x_male lnage x_urb x_unemp x_higheduc x_radio x_intpol x_knowfm
  
     
  ** Ethnicity 
  g ethn01=.
  lab var ethn01 "Powerful group"
 
  tab language if country==1
  replace ethn01=0 if country==1
  replace ethn01=. if country==1 & (language==6|language==7)
  replace ethn01=1 if country==1 & (language==15)
  tab language if country==2
  ** nobody is powerless **
  tab language if country==3
  ** irrelevant **
  tab language if country==4
  replace ethn01=0 if country==4
  replace ethn01=1 if country==4 & (language==2 |language==28 |language==31 | language==33)
  replace ethn01=. if country==4 & language==4
  tab language if country==5
  tab language if country==6
  replace ethn01=1 if country==6 & language==10
  tab language if country==7
  replace ethn01=0 if country==7 & (language==99 |language==98 |language==133)
  replace ethn01=1 if country==7 & (language==95 |language==96)
  tab language if country==8
  tab language if country==9
  replace ethn=1 if country==9 & language==196
  replace ethn=0 if country==9 & language==205
  tab language if country==10
  tab language if country==11
  tab language if country==12

  g ethn00=1-ethn01

  qui reg sap_w i.ethn00 i.country [aw=afcombwt] if knwsap, cl(country)
  est store e11
  qui reg sap_w i.ethn00 $X $P i.country [aw=afcombwt] if knwsap, cl(country)
  est store e12
  qui reg sap_w i.ethn00 $X $P $E i.country [aw=afcombwt] if knwsap, cl(country)
  est store e13
  
  ** Table A11 ** 
  estout e1*, note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons 0.* *countr*) stats(N r2_a, fmt(0 3))   
  di 0.209/0.117
  di 0.216/0.1
  margins ethn00, vce(uncond)
  
  
  qui reg sap_w i.ethn00##IMFnn i.country [aw=afcombwt] if knwsap, ro
  est store e21
  qui reg sap_w i.ethn00##IMFnn $X $P i.country [aw=afcombwt] if knwsap, cl(country)
  est store e22
  qui reg sap_w i.ethn00##IMFnn $X $P $E i.country [aw=afcombwt] if knwsap, cl(country)
  est store e23
  
  ** Table A12 **
  estout e2*, note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons 0.* *countr* 1.*#0.*) stats(N r2_a, fmt(0 3))   
  margins ethn00, vce(uncond)
 

  ** Survey probit 
  qui probit sap_w i.PIDN i.country [pw=afcombwt] if knwsap==1, vce(cl country)
  est store e31
  qui probit sap_w i.PIDN $X $P i.country [pw=afcombwt] if knwsap==1, vce(cl country)
  est store e32
  qui probit sap_w i.PIDN $X $P $E i.country [pw=afcombwt] if knwsap==1, vce(cl country)
  est store e33
  
  ** Table A13 **
  estout e3*, replace title("Survey probit") note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons 0.* *countr*) stats(N r2_p, fmt(0 3))   
  
  
  qui probit sap_w i.PIDN##IMFnn i.country [pw=afcombwt] if knwsap==1, vce(cl country)
  est store e41
  qui probit sap_w i.PIDN##IMFnn $X $P i.country [pw=afcombwt] if knwsap==1, vce(cl country)
  est store e42
  qui probit sap_w i.PIDN##IMFnn $X $P $E i.country [pw=afcombwt] if knwsap==1, vce(cl country)
  est store e43
  
  ** Table A14 **
  estout e4*, replace title("Survey probit") note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons *0.* *countr*) stats(N r2_p, fmt(0 3))   

  
  qui probit sap_w i.PIDN##c.BA2TOT i.country [pw=afcombwt] if knwsap==1, vce(cl country)
  est store e51
  qui probit sap_w i.PIDN##c.BA2TOT $X $P i.country [pw=afcombwt] if knwsap==1, vce(cl country)
  est store e52
  qui probit sap_w i.PIDN##c.BA2TOT $X $P $E i.country [pw=afcombwt] if knwsap==1, vce(cl country)
  est store e53

  ** Table A15 **
  estout e5*, replace title("Survey probit") note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons 0.* *countr*) stats(N r2_p, fmt(0 3))   


  ** MLM 
  qui meprobit sap_w i.PIDN [pw=afcombwt] if knwsap==1 || country:, vce(cl country) 
  est store e61
  qui meprobit sap_w i.PIDN $X $P [pw=afcombwt] if knwsap==1 || country:, vce(cl country) 
  est store e62
  qui meprobit sap_w i.PIDN $X $P $E [pw=afcombwt] if knwsap==1 || country:, vce(cl country) 
  est store e63
  
  ** Table A16 ** 
  estout e6*, replace title("Survey probit") note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons 0.* ) stats(N r2_p, fmt(0 3))   
  
  
  qui meprobit sap_w i.PIDN##IMFnn [pw=afcombwt] if knwsap==1 || country:, vce(cl country) 
  est store e71
  qui meprobit sap_w i.PIDN##IMFnn $X $P [pw=afcombwt] if knwsap==1 || country:, vce(cl country) 
  est store e72
  qui meprobit sap_w i.PIDN##IMFnn $X $P $E [pw=afcombwt] if knwsap==1 || country:, vce(cl country) 
  est store e73
  
  ** Table A17 **
  estout e7*, replace title("Survey probit") note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons *0.*) stats(N r2_p, fmt(0 3))   
  
  
  qui meprobit sap_w i.PIDN##c.BA2TOT [pw=afcombwt] if knwsap==1 || country:, vce(cl country) 
  est store e81
  qui meprobit sap_w i.PIDN##c.BA2TOT $X $P [pw=afcombwt] if knwsap==1 || country:, vce(cl country) 
  est store e82
  qui meprobit sap_w i.PIDN##c.BA2TOT $X $P $E [pw=afcombwt] if knwsap==1 || country:, vce(cl country) 
  est store e83
  
  ** Table A18 **
  estout e8*, replace title("Survey probit") note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons 0.*) stats(N r2_p, fmt(0 3))   
  

* Protest 
*********

* Figures

  g PARDEM=pardem-1
  replace PARDEM=5 if PARDEM==0
  
  ** Figure 10 **
  graph bar if PARDEM<6 & sapknw==2 & NoData1==0, over(PARDEM, relabel(1 "Only once/Once or twice" 2 "Sometimes/A few times" 3 "Often" 4 "Would do if I had the chance" 5 "Never") label(angle(90))) scheme(s1mono)
  
  ** Figure A8 **
  graph bar if pardem<6 & sapknw==2 & NoData1==0, over(pardem, nolabel label(angle(0))) scheme(s1mono) by(country, note( ))
  
  ** Figure 24 **
  graph bar x_prot if sapknw==2 & NoData1==0, over(sap_w, descending relabel(1 "SAP did not make my life worse" 2 "SAP made my life worse") label(angle(0))) scheme(s1mono)  ytitle(Protest)
    ttest x_prot if sapknw==2 & NoData1==0, by(sap_w) une
	** 15.4, 18.6, 3.2, p<0.0021 

  ** Figure 26 **	
  graph bar x_prot if sapknw==2 & NoData1==0, over(PIDN, relabel(2 "Opposition supporter" 1 "Government supporter")) by(IMFnn, note(" ")) scheme(s1mono) ytitle(Protest) 
    ttest x_prot if sapknw==2 & NoData1==0 & IMFnn>0, by(PIDN) une
	** diff=-0.107 p<0.0001
	ttest x_prot if sapknw==2 & NoData1==0 & IMFnn==0, by(PIDN) une 
	** diff=0.025 p<0.487
  

* Tables  

  qui reg x_prot sap_w i.country [aw=afcombwt], cl(country)
  est store b11
  qui reg x_prot sap_w $X $P i.country [aw=afcombwt], cl(country)
  est store b12
  qui reg x_prot sap_w $X $P $E i.country [aw=afcombwt], cl(country)
  est store b13
  
  ** Table 10 ** 
  estout b1*, title("Protest") note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons *country*) stats(N r2_a, fmt(0 3)) 


  qui reg x_prot i.PIDN i.country [aw=afcombwt] if knwsap==1 & L1IMFnn>0, cl(country)
  est store b21
  qui reg x_prot i.PIDN $X $P i.country [aw=afcombwt] if knwsap==1 & L1IMFnn>0, cl(country)
  est store b22
  qui reg x_prot i.PIDN $X $P $E i.country [aw=afcombwt] if knwsap==1 & L1IMFnn>0, cl(country)
  est store b23
  qui reg x_prot i.PIDN i.country [aw=afcombwt] if knwsap==1 & L1IMFnn==0, cl(country)
  est store b24
  qui reg x_prot i.PIDN $X $P i.country [aw=afcombwt] if knwsap==1 & L1IMFnn==0, cl(country)
  est store b25
  qui reg x_prot i.PIDN $X $P $E i.country [aw=afcombwt] if knwsap==1 & L1IMFnn==0, cl(country)
  est store b26
  
  ** Table 11 ** 
  estout b2*, title("Protest") note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons *country* 0.*) stats(N r2_a, fmt(0 3))
  
  su L1BA2TOT if L1IMFnn==1, d
  g L1BAsplit=L1BA2TOT>=27 
  qui reg x_prot i.PIDN i.country [aw=afcombwt] if knwsap==1 & L1BAsplit==1 & L1IMFnn==1, cl(country)
  est store b31
  qui reg x_prot i.PIDN $X $P i.country [aw=afcombwt] if knwsap==1 & L1BAsplit==1 & L1IMFnn==1, cl(country)
  est store b32
  qui reg x_prot i.PIDN $X $P $E i.country [aw=afcombwt] if knwsap==1 & L1BAsplit==1 & L1IMFnn==1, cl(country)
  est store b33
  qui reg x_prot i.PIDN i.country [aw=afcombwt] if knwsap==1 & L1BAsplit==0 & L1IMFnn==1, cl(country)
  est store b34
  qui reg x_prot i.PIDN $X $P i.country [aw=afcombwt] if knwsap==1 & L1BAsplit==0 & L1IMFnn==1, cl(country)
  est store b35
  qui reg x_prot i.PIDN $X $P $E i.country [aw=afcombwt] if knwsap==1 & L1BAsplit==0 & L1IMFnn==1, cl(country)
  est store b36
  
  ** Table 10 ** 
  estout b3*, title("Protest") note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons *country* 0.*) stats(N r2_a, fmt(0 3))


* Robustness

  ** Deprivation 
  qui reg x_prot c.x_pov##c.L1BA2TOT  i.country [aw=afcombwt] if L1IMFnn>0, cl(country)
  est store d11
  qui reg x_prot c.x_pov##c.L1BA2TOT $X $P i.country [aw=afcombwt] if L1IMFnn==1, cl(country)
  est store d12
  qui reg x_prot c.x_pov##c.L1BA2TOT $X $P $E i.country [aw=afcombwt] if L1IMFnn>0, cl(country)
  est store d13

  ** Table A25 ** 
  estout d1*, title("Protest") note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons *country* 0.*) stats(N r2_a, fmt(0 3))
  
  
  ** Selection model 
  mat S4=J(5,3,0)
  mat S5=S4
    
  qui cmp (knwsap=$F PIDN _Icountry*) (x_prot=PIDN _Icountry*), indicators(1 knwsap) ro cl(country) iterate(30)  
  est store d21
   mat S4[1,1]=e(N1)
   mat S4[4,1]=e(N2)
   qui test [knwsap] $F
   mat S4[3,1]=r(chi2)
   qui reg knwsap  PIDN $F _Icountry* 
   mat S4[2,1]=e(r2)
   qui reg x_prot PIDN _Icountry* if knwsap
   mat S4[5,1]=e(r2)
   
  qui cmp (knwsap=$F $XS PIDN _Icountry*) (x_prot=PIDN $XS _Icountry*), indicators(1 knwsap) ro cl(country) 
   est store d22
   mat S4[1,2]=e(N1)
   mat S4[4,2]=e(N2)
   qui test [knwsap] $F
   mat S4[3,2]=r(chi2)
   qui reg knwsap  PIDN $F $XS _Icountry* 
   mat S4[2,2]=e(r2)
   qui reg x_prot PIDN $XS _Icountry* if knwsap
   mat S4[5,2]=e(r2)
  
  qui cmp (knwsap=$F $XL PIDN _Icountry*) (x_prot=PIDN $XL _Icountry*), indicators(1 knwsap) ro cl(country) 
   est store d23
   mat S4[1,3]=e(N1)
   mat S4[4,3]=e(N2)
   qui test [knwsap] $F
   mat S4[3,3]=r(chi2)
   qui reg knwsap  PIDN $F $XL _Icountry* 
   mat S4[2,3]=e(r2)
   qui reg x_prot PIDN $XL _Icountry* if knwsap
   mat S4[5,3]=e(r2)
  
  ** Table A26 **   
  estout d2*,  note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons  *countr*) stats(N r2_a, fmt(0 3))   
  mat li S4 
 
 
  ** Ethnicity 
  qui reg x_prot ethn00 i.country [aw=afcombwt] if IMFnn>0, ro
  est store d31
  qui reg x_prot ethn00 $X $P [aw=afcombwt] if IMFnn>0, ro
  est store d32
  qui reg x_prot ethn00 $X $P $E [aw=afcombwt] if IMFnn>0, ro
  est store d33
  qui reg x_prot ethn00 [aw=afcombwt] if IMFnn==0, ro
  est store d34
  qui reg x_prot ethn00 $X $P [aw=afcombwt] if IMFnn==0, ro
  est store d35
  qui reg x_prot ethn00 $X $P $E [aw=afcombwt] if IMFnn==0, ro
  est store d36
  
  ** Table A27 **
  estout d3*, note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons *.coun*) stats(N r2_a, fmt(0 3))   


  qui reg sap_w i.ethn00##i.PIDN i.country [aw=afcombwt] if IMFnn>0, cl(country)
  est store d41
  qui reg sap_w i.ethn00##i.PIDN $X $P i.country [aw=afcombwt] if IMFnn>0, cl(country)
  est store d42
  qui reg sap_w i.ethn00##i.PIDN $X $P $E i.country [aw=afcombwt] if IMFnn>0, cl(country)
  est store d43

  ** Table A28 
  estout d4*, note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons *0.* *countr*) stats(N r2_a, fmt(0 3))   

    
  ** Different protest measure
  qui reg x_protall sap_w i.country [aw=afcombwt], cl(country)
  est store d51
  qui reg x_protall sap_w $X $P i.country [aw=afcombwt], cl(country)
  est store d52
  qui reg x_protall sap_w $X $P $E i.country [aw=afcombwt], cl(country)
  est store d53  
  
  ** Table A29 ** 
  estout d5*, title("Protest") note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons *country*) stats(N r2_a, fmt(0 3)) 

    
  ** Alternative econometrics models
  qui probit x_prot sap_w i.country [pw=afcombwt], vce(cl country)
  est store d61
  qui probit x_prot sap_w $X $P i.country [pw=afcombwt], vce(cl country)
  est store d62
  qui probit x_prot sap_w $X $P $E i.country [pw=afcombwt], vce(cl country)
  est store d63
  
  ** Table A30 ** 
  estout d6*, title("Protest") note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons *country*) stats(N r2_p, fmt(0 3)) 

  qui meprobit x_prot sap_w  [pw=afcombwt] || country:, vce(cl country)
  est store d71
  qui meprobit x_prot sap_w $X $P [pw=afcombwt] || country:, vce(cl country)
  est store d72
  qui meprobit x_prot sap_w $X $P $E [pw=afcombwt] || country:, vce(cl country)
  est store d73

  ** Table A31 ** 
  estout d7*, title("Protest") note("p-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_cons) stats(N r2_a, fmt(0 3)) 


* Descriptives

  qui estpost su x_prot* sap_worse x_pov psj IMFnn BA2TOT PIDN $X $P $E knwsap
  esttab ., cells("count mean sd min max") noobs




* Asian Barometer (W2)
*******************************************************************************
 
  use "Asiabarometer_replication", clear  
  
  g heardimf=q159==1
  replace heardimf=. if q159==.z
  
  g badimf=q163<5
  replace badimf=. if q163>10
  g rateimf=q163
  
  g PIDN=1*(q39a==3) +0*(q39a==2)
  replace PIDN=. if q39a==1 |q39a>3
  lab var PIDN "Opposition supporter"
    
  g prot=q88==2|q88==3
  replace prot=. if q88==1|q88>4
  g protv=q89==1|q89==2
  replace protv=. if q89>3
  
  g polindex=12-q80-q81-q82-q87
  replace polindex=. if q80>3|q81>3|q82>3|q87>3
  su polindex 
  
  g confgov=q102a==2|q102a==3
  replace confgov=. if q102a==1|q102a>5 
  g confrev=6-q102a
  replace confrev=. if q102a>5|q102a==1
  
  g male=se2==1
  g lnage=ln(se3a)
  g married=se4==2
  g higheduc=se5>=8
  g lneduc=ln(1+se5a)
  g urban=level3==2
  g employed=se12a<5
  g unemp=se12a==5
  g demsupecon=q123==4|q123==3
  g demsup=q121==3
  g obed=q134<=2
  g freedom=q110<=2
  g supmaj=q72<=2
  
  g econworse=q2<=2
  g econbadnow=q1<=2
  g econfut=q3<=2
  
  g polint=q49==4|q49==3
  g polnews=q50==5
  
  g govbias=q108==3|q108==4
  * alternative outcome for mechanism! *
  
      
  svyset country [pw=w_all]

  qui xi:reg prot i.country i.year 
  global AS1 _Icountry*
  global AS2 $AS1 male lnage urban employed lneduc demsup demsupecon
  global AS3 $AS2 econworse obed supmaj
  
  drop if country==7
  g hic=iso3=="HKG"|iso3=="JPN"|iso3=="SGP"
  ***TWN not eligible for IMF***


* IMF SAP evaluations 
*********************

* Figures 

  g GOVBIAS=.
  replace GOVBIAS=1 if q108==4
  replace GOVBIAS=2 if q108==3
  replace GOVBIAS=3 if q108==6
  replace GOVBIAS=4 if q108==2
  replace GOVBIAS=5 if q108==1  
  
  ** Figure 4 **
  graph bar if GOVBIAS<=5 & MA3IMFnn>0, over(GOVBIAS, relabel(1 "Strongly disagree" 2 "Disagree" 3 "Neither agree nor disagree" 4 "Agree" 5 "Strongly agree") label(angle(90))) note("Everyone is treated equally by the government") scheme(s1mono) 

  ** Figure A2 ** 
  graph bar if GOVBIAS<=5 & MA3IMFnn>0, by(country, note("Everyone is treated equally by the government") rows(1)) over(GOVBIAS, nolabel) scheme(s1mono) 

  g RATEIMF=rateimf if rateimf<=10 
  
  ** Figure A3 **
  graph bar if heardimf==1 & hic==0, by(country, note(" ") rows(3)) over(RATEIMF, relabel(1 "Very bad" 2 " " 3 " " 4 " " 5 "Neither good nor bad" 6 " " 7 " " 8 " " 9 " " 10 "Very good") label(angle(0))) scheme(s1mono) 
  
  ** Figure 5 **
  graph bar if heardimf==1 & hic==0, over(RATEIMF, relabel(1 "Very bad" 2 " " 3 " " 4 " " 5 "Neither good nor bad" 6 " " 7 " " 8 " " 9 " " 10 "Very good") label(angle(0))) scheme(s1mono) 

  ** Figure 15 **
  graph bar if MA3IMF>0 & q39a<4, over(q39a, relabel(1 "Non-partisan" 2 "Government supporter" 3 "Opposition supporter") label(angle(0))) scheme(s1mono)
  
  g BAhigh=MA3BA2TOT>9.34
  replace BAhigh=. if MA3IMFnn==0

  ** Figure 20 **
  graph bar govbias if MA3IMFnn>0 & heardimf==1, over(PIDN, relabel(2 "Opposition supporter" 1 "Government supporter")) scheme(s1mono) ytitle(Government is biased) by(BAhigh, note(" "))
    ttest govbias if heardimf==1 & MA3IMFnn>0 & BAhigh==1, by(PIDN) une
	** 58.6, 74.3, d=15.7, p<0.0000
	ttest govbias if heardimf==1 & MA3IMFnn>0 & BAhigh==0, by(PIDN) une
	** 23.6, 24.9, d=1.3, p=0.63

  ** Figure 21 ***
  graph bar badimf if MA3IMFnn>0 & heardimf==1, over(PIDN, relabel(2 "Opposition supporter" 1 "Government supporter")) scheme(s1mono) ytitle(Bad impression of the IMF) by(BAhigh, note(" "))
  	
	
* Tables 

  ** Evaluations of governments 
  qui reg govbias c.MA3IMFnn##PIDN $AS1 [pw=w_all] if hic==0, ro
  est store c11
  qui reg govbias c.MA3IMFnn##PIDN $AS2 [pw=w_all] if hic==0, ro
  est store c12
  qui reg govbias c.MA3IMFnn##PIDN $AS3 [pw=w_all] if hic==0, ro
  est store c13

  ** Table 4 **
  estout c1*, starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_* *0.*) stats(N r2_a, fmt(0 3))
  
  g INTX=MA3IMFnn*PIDN
  qui reg govbias MA3IMFnn PIDN INTX $AS3 [pw=w_all] if hic==0, ro 
  margins, at(PIDN=(0 1) INTX=0) vce(uncond)
  margins, at(PIDN=(0 1) INTX=(0 1)) vce(uncond)

  
  qui reg govbias c.MA3BA2TOT##PIDN  $AS1 [pw=w_all] if MA3IMF>0 & hic==0, ro
  est store c21
  qui reg govbias c.MA3BA2TOT##PIDN  $AS2 [pw=w_all] if MA3IMF>0 & hic==0, ro
  est store c22
  qui reg govbias c.MA3BA2TOT##PIDN  $AS3 [pw=w_all] if MA3IMF>0 & hic==0, ro
  est store c23
  
  ** Table 5 **
  estout c2*, starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_* *0.*) stats(N r2_a, fmt(0 3))
  margins, at(PIDN=(0 1))  


  ** Selection model
  g XPIDN=MA3BA2TOT*PIDN
  mat MM=J(5,3,0)
  qui cmp (heardimf=polint polnews MA3BA2TOT PIDN $AS1) (govbias=MA3BA2TOT PIDN XPIDN $AS1) [pw=w_all] if MA3BA2TOT>0, indicators(1 heardimf) ro iterate(30)
  est store c31
   mat MM[1,1]=e(N1)
   mat MM[4,1]=e(N2)
   qui test [heardimf]polint polnews
   mat MM[3,1]=r(chi2)
   qui reg heardimf polint polnews MA3BA2TOT PIDN $AS1 if MA3BA2TOT>0
   mat MM[2,1]=e(r2_a)
   qui reg govbias MA3BA2TOT *PIDN $AS1 if heardimf==1 & MA3BA2TOT>0
   mat MM[5,1]=e(r2_a)
   
  qui cmp (heardimf=polint polnews MA3BA2TOT PIDN $AS2) (govbias=MA3BA2TOT PIDN XPIDN $AS2) [pw=w_all] if MA3BA2TOT>0, indicators(1 heardimf) ro iterate(30)
  est store c32
   mat MM[1,2]=e(N1)
   mat MM[4,2]=e(N2)
   qui test [heardimf]polint polnews
   mat MM[3,2]=r(chi2)
   qui reg heardimf polint polnews MA3BA2TOT PIDN $AS2 if MA3BA2TOT>0
   mat MM[2,2]=e(r2_a)
   qui reg govbias MA3BA2TOT *PIDN $AS2 if heardimf==1 & MA3BA2TOT>0
   mat MM[5,2]=e(r2_a)
   
  qui cmp (heardimf=polint polnews MA3BA2TOT PIDN $AS3) (govbias=MA3BA2TOT PIDN XPIDN $AS3) [pw=w_all] if MA3BA2TOT>0, indicators(1 heardimf) ro iterate(30)
  est store c33
   mat MM[1,3]=e(N1)
   mat MM[4,3]=e(N2)
   qui test [heardimf]polint polnews
   mat MM[3,3]=r(chi2)
   qui reg heardimf polint polnews MA3BA2TOT PIDN $AS3 if MA3BA2TOT>0
   mat MM[2,3]=e(r2_a)
   qui reg govbias MA3BA2TOT *PIDN $AS3 if heardimf==1 & MA3BA2TOT>0
   mat MM[5,3]=e(r2_a)
   
  ** Table A19 ** 
  estout c3*, starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*  ) 
  mat li MM
  
  qui reg govbias MA3BA2TOT XPIDN PIDN male lnage urban employed lneduc demsup demsupecon confgov econworse obed supmaj [pw=w_all] if MA3IMFnn>0 & heardimf==1
  margins, at(MA3BA2TOT=13.67 XPIDN=13.67 PIDN=1)
  margins, at(MA3BA2TOT=13.67 XPIDN=0 PIDN=0)

  
  ** Evaluations of IMF   
  qui reg badimf c.MA3IMFnn##PIDN govbias $AS1 [pw=w_all] if heardimf==1 & hic==0, ro
  est store c41 
  qui reg badimf c.MA3IMFnn##PIDN govbias $AS2 [pw=w_all] if heardimf==1 & hic==0, ro
  est store c42
  qui reg badimf c.MA3IMFnn##PIDN govbias $AS3 [pw=w_all] if heardimf==1 & hic==0, ro
  est store c43
  
  ** Table A20 **
  estout c4*, starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_* *0.*) stats(N r2_a, fmt(0 3))
  
  
  qui reg badimf c.MA3BA2TOT##PIDN govbias $AS1 [pw=w_all] if MA3BA2TOT>0 & heardimf==1 & hic==0
  est store c51
  qui reg badimf c.MA3BA2TOT##PIDN govbias $AS2 [pw=w_all] if MA3BA2TOT>0 & heardimf==1 & hic==0
  est store c52
  qui reg badimf c.MA3BA2TOT##PIDN govbias $AS3 [pw=w_all] if MA3BA2TOT>0 & heardimf==1 & hic==0
  est store c53
  
  ** Table A21 **
  estout c5*, starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_* *0.*) stats(N r2_a, fmt(0 3))

  
* Protest
*********

* Figures

  ** Figure 11 **
  graph bar if MA3IMF>0 & heardimf==1 & q88<5, over(q88) scheme(s1mono)
  
  ** Figure A9 **
  graph bar if hic==0 & heardimf==1 & q88<5, by(country, note(" ") rows(2)) over(q88, nolabel) scheme(s1mono) note(" ")
  
  ** Figure A12 **
  graph bar prot if MA3IMF>0 & heardimf==1 , over(govbias, descending relabel(1 "Government is not biased" 2 "Government is biased") label(angle(0))) scheme(s1mono) legend(off) note(" ") ytitle(Protest)
  
  ** Figure A13 **
  graph bar prot if MA3IMF>0 & heardimf==1 , over(badimf, descending relabel(1 "Good impression of the IMF" 2 "Bad impression of the IMF") label(angle(0))) scheme(s1mono) legend(off) note(" ") ytitle(Protest)

  ** Figure 28 **
  g ANY=MA3IMF>0

  graph bar prot if hic==0, over(PIDN, relabel(1 "Government supporter" 2 "Opposition supporter")) by(ANY, note("")) scheme(s1mono) ytitle(Protest) 
  
  ** Figure 29 **
  graph bar prot if MA3IMF>0 & heardimf==1, over(PIDN, relabel(1 "Government supporter" 2 "Opposition supporter")) by(BAhigh, note(" ")) scheme(s1mono) ytitle(Protest) 
    ttest prot if MA3IMF>0 & heardimf==1 & BAhigh==1, by(PIDN) une
    ttest prot if MA3IMF>0 & heardimf==1 & BAhigh==0, by(PIDN) une
  
  
* Tables

  qui reg prot c.MA3IMFnn##govbias $AS1 [pw=w_all] if hic==0, vce(cl country)
  est store c61
  qui reg prot c.MA3IMFnn##govbias $AS2 [pw=w_all] if hic==0, vce(cl country)
  est store c62
  qui reg prot c.MA3IMFnn##govbias $AS3 [pw=w_all] if hic==0, vce(cl country)
  est store c63
  
  ** Table 14 **
  estout c6*, starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*  *0.*) stats(N r2_a, fmt(0 3))
  
  g IMFgovbias=MA3IMFnn*govbias
  qui reg prot MA3IMFnn IMFgovbias govbias $AS3 [pw=w_all] if hic==0, vce(cl country)
  margins , at(govbias=1 IMFgovbias=(0 1))

  
  qui reg prot c.MA3BA2TOT##govbias $AS1 [pw=w_all] if MA3IMFnn>0, vce(cl country)
  est store c71
  qui reg prot c.MA3BA2TOT##govbias $AS2 [pw=w_all] if MA3IMFnn>0, vce(cl country)
  est store c72
  qui reg prot c.MA3BA2TOT##govbias $AS3 [pw=w_all] if MA3IMFnn>0, vce(cl country)
  est store c73
   
  ** Table A15 **   
  estout c7*, starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*  *0.*) stats(N r2_a, fmt(0 3))
  
  
  qui reg prot c.MA3IMF##PIDN $AS1 [pw=w_all] if hic==0, vce(cl country)
  est store c81
  qui reg prot c.MA3IMF##PIDN $AS2 [pw=w_all] if hic==0, vce(cl country)
  est store c82
  qui reg prot c.MA3IMF##PIDN $AS3 [pw=w_all] if hic==0, vce(cl country)
  est store c83
  
  ** Table A16 **
  estout c8*, starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*  *0.*) stats(N r2_a, fmt(0 3))
    
  
  qui reg prot c.MA3BA2TOT##PIDN $AS1 [pw=w_all] if MA3IMFnn>0, vce(cl country)
  est store c91
  qui reg prot c.MA3BA2TOT##PIDN $AS2 [pw=w_all] if MA3IMFnn>0, vce(cl country)
  est store c92
  qui reg prot c.MA3BA2TOT##PIDN $AS3 [pw=w_all] if MA3IMFnn>0, vce(cl country)
  est store c93
   di 0.005*(MA3BA2TOT=(9.33 13.67)) - 0.015*PIDN(0 1)
   di 0.005*13.67-0.015
   di 0.005*13.67
   di 0.005*9.33-0.015
   di 0.005*9.33
   
  ** Table A17 **   
  estout c9*, title("Survey regression") note("P-values:") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*  *0.*) stats(N r2_a, fmt(0 3))
  
 
  g Xgovbias=MA3BA2TOT*govbias
  qui cmp (heardimf=polint polnews MA3BA2TOT PIDN $AS1) (prot=MA3BA2TOT govbias Xgovbias $AS1) [pw=w_all] if MA3BA2TOT>0, indicators(1 heardimf) ro cl(country) iterate(30)
  
  ** Figure A14 **
  grinter govbias, const(MA3BA2TOT) inter(Xgovbias) eq(prot) depvar(prot) clevel(90) scheme(s1mono) yline(0)
 
 
  qui cmp (heardimf=polint polnews MA3BA2TOT PIDN $AS1) (prot=MA3BA2TOT PIDN XPIDN $AS1) [pw=w_all] if MA3BA2TOT>0, indicators(1 heardimf) ro cl(country) iterate(30)
  
  ** Figure A15 **
  grinter PIDN, const(MA3BA2TOT) inter(XPIDN) eq(prot) depvar(prot) clevel(90) scheme(s1mono) yline(0) xtitle(Total conditions) ytitle("Marginal effect of 'Opposition supporter'" "on protest")

   
* Latinobarometer (2005)
*******************************************************************************

  use "Latinobarometer_replication", clear  
  
  g educworse=p90stb==4|p90stb==5 
  replace educworse=. if p90stb<1
  g healthworse=p90sta==4|p90sta==5
  replace healthworse=. if p90sta<1
  
  foreach x in p72sta p72stb p72stc p72std p72ste p72stf{
    replace `x'=. if `x'<1
	}
  
  g x_prot=p72stb==1|p72ste==1|p72stc==1
  lab var x_prot "Protest (any of 3 indicators)"
  su *prot* p72stb

  foreach x in s7 s6 s12 s9 s11 s15a s15b s15c s15d s15e s15f s15f s15g s15h s15i s15j s15k s15l p37st p46st p62sta p62stb p62stc p70a p34 p25sta p25stb p29 p72sta p72stb p72stc p72std p72ste p72stf p84{
  replace `x'=. if `x'<0
  }
  
  g lnage=ln(s7)
  g male=s6==1
  g edupar=ln(s12)
  g married=s9==1
  g lneduc=ln(s11)
  g wealthindex=s15a+s15b+s15c+s15d+s15e+s15f+s15g+s15h+s15i+s15l+s15j+s15k
  g infoindex=p62sta+p62stb+p62stc
  g knowpol=p46st<=2
  g polint=p37st<=2
  
  g x_demsup=p25stb==1|p25stb==2
  g x_marsup=p25sta==1|p25sta==2
  g x_satpresbad=p29st==2
  g x_govcorr=ln(p84st)
  
  codebook p34st
  g R=p34st>=6
  g MA3OPP2=(R-round(1-MA3left))^2
  su MA3OPP2

  
  global X lnage male edupar lneduc p70a wealthindex infoindex
  global V x_demsup x_marsup x_satpresbad x_govcorr 

  encode iso3, g(cid)
  svyset cid [pw=wt] 
  
  g ANY=MA3IMF>0
  tab iso3 if ANY
  g hic=iso3=="URY"|iso3=="CHL"
  

* IMF SAP evaluations
*********************

* Figures

  g ma3opp2_all=MA3OPP2
  replace ma3opp2_all=-1 if p49stu!=1

  ** Figure 16 **
  graph bar if hic==0 & MA3IMF>0, over(ma3opp2_all, relabel(1 "Non-partisan" 2 "Government supporter" 3 "Opposition supporter")) scheme(s1mono) ytitle(Percent) 
  
  ** Figure A4 **
  graph bar if p91stb>0 & MA3IMF>0, over(p91stb, label(angle(90))) scheme(s1mono) note("Satisfaction with public education received")

  ** Figure A5 **
   graph bar if p91stb>0 & MA3IMF>0 & hic==0, by(country, note(" ")) over(p91stb, nolabel label(angle(0))) scheme(s1mono) note("Satisfaction with public education received") note(" ")

  ** Figure 6 **
  graph bar if p90stb>0 & MA3IMF>0, over(p90stb, label(angle(90))) scheme(s1mono) note("Quality of public education compared to before")

  ** Figure A6 **  
  graph bar if p91sta>0 & MA3IMF>0, over(p91sta, label(angle(90))) scheme(s1mono) note("Satisfaction with public health services received")

  ** Figure A7 **
   graph bar if p91sta>0 & MA3IMF>0 & hic==0, by(country, note(" ")) over(p91sta, nolabel label(angle(0))) scheme(s1mono) note("Satisfaction with public health services received") note(" ")

  ** Figure 7 **
  graph bar if p90sta>0 & MA3IMF>0, over(p90sta, label(angle(90))) scheme(s1mono) note("Quality of public health compared to before")


  g BAhigh=MA3BA2TOT>=23

  ** Figure 22 **
  graph bar educw if ANY==1 & hic==0, over(MA3OPP2, relabel(1 "Government supporter" 2 "Opposition supporter")) by(BAhigh, note(" ")) scheme(s1mono) ytitle(Public education worsened)

  
* Tables

  qui reg educw c.MA3IMFnn##MA3OPP2 $X $V i.cid [aw=wt] if hic==0 & p49stu==1, cl(country)
  est store f11
  qui reg healthw c.MA3IMFnn##MA3OPP2 $X $V i.cid [aw=wt] if hic==0 & p49stu==1, cl(country)
  est store f12

  ** Table 6 **
  estout f1*, note("P-values: * 10%  ** 5%  *** 1%") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*  *0.* *cid*) stats(N r2_a, fmt(0 3))

  
   qui reg educw c.MA3BA2TOT##i.MA3OPP2 $X $V i.cid [aw=wt] if MA3IMFnn>0 & p49stu==1
   est store f21
   qui reg healthw c.MA3BA2TOT##i.MA3OPP2 $X $V i.cid [aw=wt] if MA3IMFnn>0 & p49stu==1
   est store f22

  ** Table 7 ** 
  estout f2*, title("Survey regression") note(" ") starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*  *0.* *cid*) stats(N r2_a, fmt(0 3))

  
* Protest
*********

* Figures 

  g PROT=p72stb

  ** Figure 12 **
  graph bar if MA3IMFnn>0, over(PROT, relabel(1 "Have done" 2 "Could do" 3 "Would never do") label(angle(90))) scheme(s1mono)
  
  ** Figure 30(a) **
  graph bar x_prot if MA3IMFnn>0  &hic==0, over(educw, relabel(2 "Public education worse than before" 1 "Public education not worse than before")) scheme(s1mono) ytitle(" ") 
  
  ** Figure 30(b) **
  graph bar x_prot if MA3IMFnn>0  &hic==0, over(healthw, relabel(2 "Public health worse than before" 1 "Public health not worse than before")) scheme(s1mono) ytitle(" ") 

  ** Figure 31 **
  graph bar x_prot if MA3IMFnn>0 & hic==0, by(BAhigh, note(" ")) over(MA3OPP2, relabel(2 "Opposition supporter" 1 "Government supporter")) scheme(s1mono) ytitle(" ") 

  
* Tables 

  qui reg x_prot c.MA3IMFnn##i.MA3OPP2 i.cid [aw=wt] if p49stu==1 & hic==0, cl(country)
  est store p11
  qui reg x_prot c.MA3IMFnn##i.MA3OPP2 $X i.cid [aw=wt] if p49stu==1 & hic==0, cl(country)
  est store p12
  qui reg x_prot c.MA3IMFnn##i.MA3OPP2 $X $V i.cid [aw=wt] if p49stu==1 & hic==0, cl(country)
  est store p13

  ** Table 17 **
  estout p1*, starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*  *0.* *cid*) stats(N r2_a, fmt(0 3))
 

  qui reg x_prot c.MA3BA2TOT##i.MA3OPP2 i.cid [aw=wt] if MA3IMF>0 & p49stu==1 & hic==0, cl(country)
  est store p21
  qui reg x_prot c.MA3BA2TOT##i.MA3OPP2 $X i.cid [aw=wt] if MA3IMF>0 & p49stu==1 & hic==0, cl(country)
  est store p22 
  qui reg x_prot c.MA3BA2TOT##i.MA3OPP2 $X $V i.cid [aw=wt] if MA3IMF>0 & p49stu==1 & hic==0, cl(country) 
  est store p23

  ** Table 18 **
  estout p2*, starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) drop(_*  *0.* *cid*) stats(N r2_a, fmt(0 3))

  
* World Values Survey
******************************************************************

  use "WVS_replication", clear

  g lr=E033 if E033>0
  g Left=lr>=1 & lr<=5 & lr!=.
  g MA3OPP=(Left-ceil(MA3left))^2
  g OPP=(Left-leftany)^2

  g conf_gov=1 if E069_11>=1 & E069_11<=2
  replace conf_gov=0 if E069_11>=3 & E069_11<=4
  replace conf_gov=. if E069_11<1

  g hardship=no_food+no_med+no_inc-3
 
  g male=1-women
  g lnage=ln(age)
  des married
  g nhh=X011 if X011>=0
  g undemp=X028!=1
  replace undemp=. if X028<1
  lab var undemp "Un(der)employed"
  g educ=(X025R==2|X025R==3)
  replace educ=. if X025R<1
  g polint=E023==1|E023==2
  replace polint=. if E023<1
  g demdem=E117==1|E117==2
  replace demdem=. if E117<1
  g demgrowth=B008==2
  replace demgro=. if B008<1
  g demequal=E035>=1 & E035<=5
  replace demequal=. if E035<1


  global X1 male lnage married nhh undemp educ polint 
  global X2 demdem demgrowth demequal conf_gov 

  g MA3OPP2=(Left-round(MA3left))^2
   

* IMF SAP experiences
*********************  

* Figures

  ** Figure 9 **
  graph bar, over(income_3, relabel(1 "Low income" 2 "Medium income" 3 "High income") label(angle(90))) scheme(s1mono) ytitle(Percent) 
  
  ** Figure 8 ** 
  graph bar, over(hardship, label(angle(0)))  scheme(s1mono) ytitle(Percent) 
  
  graph bar, over(MA3OPP2, relabel(1 "Government supporter" 2 "Opposition supporter") label(angle(0))) scheme(s1mono) ytitle(Percent) 

  g ANYCRIS=(MA3crisis>0)  
  g ANYIMF=MA3IMF>0
  
  ** Figure 23 **
  graph bar hardship if MA3crisis>0, over(MA3OPP2, relabel(1 "Government supporter" 2 "Opposition supporter")) by(ANYIMF, note(" ")) scheme(s1mono) ytitle(Deprivation index) 
   ttest hardship if MA3crisis>0 & MA3IMF>0, by(MA3OPP2)

  ** Figure A11 ** 
  graph bar income_3 if MA3crisis>0, over(MA3OPP2, relabel(1 "Government supporter" 2 "Opposition supporter")) by(ANYIMF, note(" ")) scheme(s1mono) ytitle(Income group)
   ttest income_3 if MA3crisis>0 & MA3IMF>0, by(MA3OPP2)


* Tables

  qui reghdfe hardship c.MA3cris##MA3OPP2 [pw=S017] if MA3IMFnn>0, a(iso3 year) cl(iso3)
  est store w11
  qui reghdfe hardship c.MA3cris##MA3OPP2 $X1 [pw=S017] if MA3IMFnn>0, a(iso3 year) cl(iso3)
  est store w12
  qui reghdfe hardship c.MA3cris##MA3OPP2 $X1 $X2 [pw=S017] if MA3IMFnn>0, a(iso3 year) cl(iso3)
  est store w13
  qui reghdfe hardship c.MA3cris##MA3OPP2 [pw=S017] if MA3IMFnn==0, a(iso3 year) cl(iso3)
  est store w14
  qui reghdfe hardship c.MA3cris##MA3OPP2 $X1 [pw=S017] if MA3IMFnn==0, a(iso3 year) cl(iso3)
  est store w15
  qui reghdfe hardship c.MA3cris##MA3OPP2 $X1 $X2 [pw=S017] if MA3IMFnn==0, a(iso3 year) cl(iso3)
  est store w16

  ** Table 9 **
  estout w1*, drop(*0.* _*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))
 
  est restore w13
  margins, at(MA3crisis_LV=(0 1) MA3OPP2=(0 1))
  est restore w16
  margins, at(MA3crisis_LV=(0 1) MA3OPP2=(0 1))
  
  
  qui reghdfe income_3 c.MA3cris##MA3OPP2 [pw=S017] if MA3IMFnn>0, a(iso3 year) cl(iso3)
  est store w21
  qui reghdfe income_3 c.MA3cris##MA3OPP2 $X1 [pw=S017] if MA3IMFnn>0, a(iso3 year) cl(iso3)
  est store w22
  qui reghdfe income_3 c.MA3cris##MA3OPP2 $X1 $X2 [pw=S017] if MA3IMFnn>0, a(iso3 year) cl(iso3)
  est store w23
  qui reghdfe income_3 c.MA3cris##MA3OPP2 [pw=S017] if MA3IMFnn==0, a(iso3 year) cl(iso3)
  est store w24
  qui reghdfe income_3 c.MA3cris##MA3OPP2 $X1 [pw=S017] if MA3IMFnn==0, a(iso3 year) cl(iso3)
  est store w25
  qui reghdfe income_3 c.MA3cris##MA3OPP2 $X1 $X2 [pw=S017] if MA3IMFnn==0, a(iso3 year) cl(iso3)
  est store w26

  ** Table A22 **
  estout w2*, drop(*0.* _*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))
  
  est restore w23
  margins, at(MA3crisis_LV=(0 1) MA3OPP2=(0 1)) 
  ** 0, G: 1.761 (1.722-1.801) 0, O wIMF: 1.767 (1.729-1.805)
  ** 1, G: 1.562 (1.300-1.825) 1, O wIMF: 1.497 (1.245-1.750)
  est restore w26
  margins, at(MA3crisis_LV=(0 1) MA3OPP2=(0 1)) 
  ** 0, G: 1.850 (1.834-1.865) 0, O woIMF (baseline): 1.848 (1.829-1.866)
  ** 1, G: 1.934 (1.764-2.103) 1, O woIMF: 1.895 (1.712-2.079)
  
  
  qui reghdfe hardship L2cris##MA3OPP2 [pw=S017] if L2IMFnn>0, a(iso3 year) cl(iso3)
  est store w31
  qui reghdfe hardship L2cris##MA3OPP2 $X1 [pw=S017] if L2IMFnn>0, a(iso3 year) cl(iso3)
  est store w32
  qui reghdfe hardship L2cris##MA3OPP2 $X1 $X2 [pw=S017] if L2IMFnn>0, a(iso3 year) cl(iso3)
  est store w33
  qui reghdfe hardship L2cris##MA3OPP2 [pw=S017] if L2IMFnn==0, a(iso3 year) cl(iso3)
  est store w34
  qui reghdfe hardship L2cris##MA3OPP2 $X1 [pw=S017] if L2IMFnn==0, a(iso3 year) cl(iso3)
  est store w35
  qui reghdfe hardship L2cris##MA3OPP2 $X1 $X2 [pw=S017] if L2IMFnn==0, a(iso3 year) cl(iso3)
  est store w36

  ** Table A23 **
  estout w3*, drop(*0.* _*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))
  

  qui reghdfe income_3 L2cris##MA3OPP2 [pw=S017] if L2IMFnn>0, a(iso3 year) cl(iso3)
  est store w41
  qui reghdfe income_3 L2cris##MA3OPP2 $X1 [pw=S017] if L2IMFnn>0, a(iso3 year) cl(iso3)
  est store w42
  qui reghdfe income_3 L2cris##MA3OPP2 $X1 $X2 [pw=S017] if L2IMFnn>0, a(iso3 year) cl(iso3)
  est store w43
  qui reghdfe income_3 L2cris##MA3OPP2 [pw=S017] if L2IMFnn==0, a(iso3 year) cl(iso3)
  est store w44
  qui reghdfe income_3 L2cris##MA3OPP2 $X1 [pw=S017] if L2IMFnn==0, a(iso3 year) cl(iso3)
  est store w45
  qui reghdfe income_3 L2cris##MA3OPP2 $X1 $X2 [pw=S017] if L2IMFnn==0, a(iso3 year) cl(iso3)
  est store w46

  ** Table A24 **
  estout w4*, drop(*0.* _*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))



* Protest
*********

  g protest=E221B==1
  replace protest=. if E221B<1
  lab var protest "Have recently done: Attending peaceful/lawful demonstrations"
  
  
* Figures

  g PROTEST=1-protest
  
  ** Figure 13 **
  graph bar , over(PROTEST, relabel(1 "Yes" 2 "No") label(angle(00))) scheme(s1mono) ytitle(Percent) 

  ** Figure 32 **
  graph bar protest if MA3crisis>0, over(MA3OPP2, relabel(1 "Government supporter" 2 "Opposition supporter")) by(ANYIMF, note(" ")) scheme(s1mono) ytitle(Protest)
   ttest protest if MA3crisis>0 & MA3IMF>0, by(MA3OPP2)
   ttest protest if MA3crisis>0 & MA3IMF==0, by(MA3OPP2)
   ttest MA3fh_inv if MA3cris>0, by(ANYIMF)
   

* Tables  
  
  qui reghdfe protest c.MA3cris##MA3OPP2 [pw=S017] if MA3IMFnn>0, a(iso3 year) cl(iso3)
  est store w51
  qui reghdfe protest c.MA3cris##MA3OPP2 $X1 [pw=S017] if MA3IMFnn>0, a(iso3 year) cl(iso3)
  est store w52
  qui reghdfe protest c.MA3cris##MA3OPP2 $X1 $X2 [pw=S017] if MA3IMFnn>0, a(iso3 year) cl(iso3)
  est store w53
  qui reghdfe protest c.MA3cris##MA3OPP2 [pw=S017] if MA3IMFnn==0, a(iso3 year) cl(iso3)
  est store w54
  qui reghdfe protest c.MA3cris##MA3OPP2 $X1 [pw=S017] if MA3IMFnn==0, a(iso3 year) cl(iso3)
  est store w55
  qui reghdfe protest c.MA3cris##MA3OPP2 $X1 $X2 [pw=S017] if MA3IMFnn==0, a(iso3 year) cl(iso3)
  est store w56

  ** Table 19 **
  estout w5*, drop(*0.* _*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))


  qui reghdfe protest L2cris##MA3OPP2 [pw=S017] if L2IMFnn>0, a(iso3 year) cl(iso3)
  est store w61
  qui reghdfe protest L2cris##MA3OPP2 $X1 [pw=S017] if L2IMFnn>0, a(iso3 year) cl(iso3)
  est store w62
  qui reghdfe protest L2cris##MA3OPP2 $X1 $X2 [pw=S017] if L2IMFnn>0, a(iso3 year) cl(iso3)
  est store w63
  qui reghdfe protest L2cris##MA3OPP2 [pw=S017] if L2IMFnn==0, a(iso3 year) cl(iso3)
  est store w64
  qui reghdfe protest L2cris##MA3OPP2 $X1 [pw=S017] if L2IMFnn==0, a(iso3 year) cl(iso3)
  est store w65
  qui reghdfe protest L2cris##MA3OPP2 $X1 $X2 [pw=S017] if L2IMFnn==0, a(iso3 year) cl(iso3)
  est store w66

  ** Table A34 **
  estout w6*, drop(*0.* _*) starlevels(* .1 ** .05 *** .01) cells((b(star fmt(3)) se(par fmt(3)))) stats(N N_clust r2_a, fmt(0 0 3))

  
  qui estpost su income_3 hardship protest MA3cris MA3IMFnn MA3OPP2 $X1 $X2 S017 
  
  ** Table A5 **
  esttab ., cells("count mean sd min max") noobs




  